<?php

use Illuminate\Routing\Router;


Route::group([
	'prefix' => 'admin/decoration',
	'namespace' => 'Frieza\\Modules\\Decoration\\Controllers',
	'middleware' => [
		'web',
		'admin'
	],
], function (Router $router) {

    //1级类目列表
    $router->get('/category', 'CategoryController@list');


    //修改2级类目
    $router->get('/category/{parentId}/edit', 'CategoryController@edit');
    //修改3级类目
    $router->get('/category/{parentId}/edit/{sonId}/edit', 'CategoryController@edit');
    //创建1级类目
    $router->get('/category/create', 'CategoryController@edit');
    //创建2级类目
    $router->get('/category/{parentId}/edit/create', [
        'uses' => 'CategoryController@edit',
        'as' => '2'
    ]);
    //创建3级类目
    $router->get('/category/{parentId}/edit/{sonId}/edit/create', [
        'uses' => 'CategoryController@edit',
        'as' => '3'
    ]);
    //编辑1级类目列表页面
    $router->put('/category/{categoryId}', 'CategoryController@editCategory');
    //删除1级类目
    $router->delete('/category/{categoryId}', 'CategoryController@del');
    //删除2级类目
    $router->delete('/category/{parentId}/edit/{categoryId}', 'CategoryController@del');
    //排序1级类目
    $router->post('/sort', 'CategoryController@sort');
    //排序2级类目
    $router->post('/category/{categoryId}/sort', 'CategoryController@sort');
    //触发保存类目
	$router->post('/category/save', 'CategoryController@save');
	//主题页面
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject', 'SubjectController@list');
    $router->get('/subject', 'SubjectController@list');
    //主题创建
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject/create', 'SubjectController@edit');
    //主题删除
    $router->delete('/category/{parentId}/edit/{sonId}/edit/subject/{sid}',  'SubjectController@del');
    //主题编辑
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/edit', 'SubjectController@edit');
    //主题保存
    $router->post('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/save', 'SubjectController@save');
    //广告位列表
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv', 'AdvController@list');
    $router->get('/category/{parentId}/edit/{sonId}/edit/adv', 'AdvController@list');
    $router->get('/category/{parentId}/edit/adv', 'AdvController@list');
    $router->get('/subject/{sid}/adv', 'AdvController@list');
    //广告位排序
    $router->post('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/sort', 'AdvController@sort');
    $router->post('/category/{parentId}/edit/{sonId}/edit/adv/sort', 'AdvController@sort');
    $router->post('/category/{parentId}/edit/{sonId}/edit/sort', 'AdvController@sort');
    $router->post('/subject/{sid}/sort', 'AdvController@sort');
    //广告位删除
    $router->delete('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv/{aid}', 'AdvController@del');
    $router->delete('/category/{parentId}/edit/{sonId}/edit/adv/{aid}', 'AdvController@del');
    $router->delete('/category/{parentId}/edit/adv/{aid}', 'AdvController@del');
    $router->delete('/subject/{sid}/adv/{id}', 'AdvController@del');
    //广告位编辑
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv/{aid}/edit', 'AdvController@create');
    $router->get('/category/{parentId}/edit/{sonId}/edit/adv/{aid}/edit', 'AdvController@create');
    $router->get('/subject/{sid}/adv/{aid}/edit', 'AdvController@create');
    //广告位创建
    $router->get('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv/create', 'AdvController@create');
    $router->get('/category/{parentId}/edit/{sonId}/edit/adv/create', 'AdvController@create');
    $router->get('/category/{parentId}/edit/adv/create', 'AdvController@create');
    $router->get('/subject/{sid}/adv/create', 'AdvController@create');
    //广告位编辑
    $router->post('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv/save', 'AdvController@save');
    $router->post('/category/{parentId}/edit/{sonId}/edit/adv/save', 'AdvController@save');
    $router->post('/category/{parentId}/edit/adv/save', 'AdvController@save');
    $router->post('/subject/{sid}/adv/save', 'AdvController@save');
    //广告位编辑link
    $router->put('/category/{parentId}/edit/{sonId}/edit/subject/{sid}/adv/{aid}', 'AdvController@saveLink');
    $router->put('/category/{parentId}/edit/{sonId}/edit/adv/{aid}', 'AdvController@saveLink');
    $router->put('/subject/{sid}/adv/{id}', 'AdvController@saveLink');

    //创建主题
    $router->get('/subject/create', 'SubjectController@create');
    $router->post('/subject/save', 'SubjectController@save');
    //编辑主题
    $router->get('/subject/create/{id}/edit', 'SubjectController@create');
    $router->delete('/subject/create/{id}', 'SubjectController@delete');
    //单独创建分类banner广告位
    $router->get('/adv/createadv', 'AdvController@createAdv');
    //主题位排序
    $router->get('/subject/sorts/{parentId}/{sonId}', 'SubjectController@sorts');
    $router->post('/subject/sorts/{sonId}/sort', 'SubjectController@sort');

    $router->post('/subject/edit', 'SubjectController@edit');
    $router->get('/subject/del/{id}', 'SubjectController@del');

    $router->get('/tag/{sid}', 'TagController@index');
    $router->post('/tag/edit/{sid}', 'TagController@edit');
    $router->get('/tag/del/{id}/{sid}', 'TagController@del');

    $router->get('/adv/{sid}', 'AdvController@index');
    $router->get('/adv/{sid}/create', 'AdvController@create');
    $router->post('/adv/edit/{sid}', 'AdvController@edit');
    $router->get('/adv/del/{id}/{sid}', 'AdvController@del');
    $router->put('/adv/{sid}/{id}', 'AdvController@edit');


    //mainCategory
    $router->get('/maincategory', 'MainCategoryController@index');
    $router->get('/maincategory/create', 'MainCategoryController@create');
    $router->get('/maincategory/create/{categoryId}', 'MainCategoryController@create');
    $router->post('/maincategory/save', 'MainCategoryController@save');
    $router->put('/maincategory/{id}', 'MainCategoryController@save');

    $router->get('/maincategory/subject/create/{rela_id}', 'MainCategoryController@createSubject');
    $router->get('/maincategory/subject/create/{rela_id}/{id}', 'MainCategoryController@createSubject');
    $router->post('/maincategory/save/subject/{category_id}', 'MainCategoryController@saveSubject');

    $router->get('/maincategory/getsubject/{rela_id}', 'MainCategoryController@SubjectList');

    $router->get('/maincategory/subjectlist/{rela_id}', 'MainCategoryController@getSubjectList');
    //删除分类
    $router->post('/maincategory/del/{id}','MainCategoryController@delcategory');



    //banner
    $router->get('/maincategory/banner/create', 'MainCategoryController@createBanner');
    $router->get('/maincategory/banner/create/{id}', 'MainCategoryController@createBanner');
    $router->post('/maincategory/banner/save', 'MainCategoryController@saveBanner');
    $router->put('/maincategory/banner/{id}', 'MainCategoryController@saveBanner');
    $router->post('/maincategory/sort', 'MainCategoryController@sortbanner');
    $router->post('/maincategory/bannerdel/{id}','MainCategoryController@delbanner');




    $router->get('/maincategory/list', 'MainCategoryController@list');
    $router->get('/maincategory/banner', 'MainCategoryController@getBanner');

    //排序
    $router->post('/maincategory/getsubject/sort', 'MainCategoryController@sort');

    //查看相关主题
    $router->get('/mainsubject', 'MainSubjectController@index');
    $router->get('/mainsubject/create', 'MainSubjectController@create');
    $router->get('/mainsubject/create/{id}', 'MainSubjectController@create');
    $router->post('/mainsubject/save', 'MainSubjectController@save');
    $router->post('/mainsubject/del/{id}', 'MainSubjectController@delsubject');


    //更新缓存


    //查看相关tag
    $router->get('/mainadv/taglist/{sid}', 'MainAdvController@taglist');
  //  $router->get('mainadv/taglist/{sid}/{id}', 'MainAdvController@editTagIsShow');

    $router->post('/mainadv/taglist/sort', 'MainAdvController@sort');
    $router->get("/mainadv/tag/create/{sid}" , "MainAdvController@createTag");
    $router->get("/mainadv/tag/create/{sid}/{id}" , "MainAdvController@createTag");
    $router->post('/mainadv/tag/save/{sid}', 'MainAdvController@tagSave');
    $router->put('/mainadv/taglist/{sid}/{id}', 'MainAdvController@tagSave');

    $router->post('/mainadv/del/{id}', 'MainAdvController@delte');


    //查看相关banner
    $router->get('/mainadv/subjectbannerlist/{sid}', 'MainAdvController@SubjectBannerList');

    $router->post('/mainadv/subjectbannerlist/sort', 'MainAdvController@SubjectBannerSort');
    $router->get("/mainadv/subjectbanner/create/{sid}" , "MainAdvController@createSubjectBanner");
    $router->get("/mainadv/subjectbanner/create/{sid}/{id}" , "MainAdvController@createSubjectBanner");
    $router->post('/mainadv/subjectbanner/save/{sid}', 'MainAdvController@SubjectBannerSave');
    $router->put('/mainadv/subjectbanner/{sid}/{id}', 'MainAdvController@SubjectBannerSave');
    $router->put('/mainadv/subjectbannerlist/{sid}/{id}', 'MainAdvController@SubjectBannerSave');
    $router->post('mainadv/subjectbannerlist/bannersort', 'MainAdvController@BannerSort');




    //查看相关的subject content
    $router->get('/mainadv/subjectlist/{sid}', 'MainAdvController@ContentList');
    $router->post('/maintag/subjectlist/sort', 'MainAdvController@sort');
    $router->post('/mainadv/edittime/{id}', 'MainAdvController@EditTime');
    $router->get('/mainadv/moudlesort/{sid}', 'MainAdvController@MoudleSort');
    $router->post('/mainadv/moudlesort/sortmoudle', 'MainAdvController@sortmoudle');
    $router->get('/mainadv/contentmoudle/create/{sid}', 'MainAdvController@createcontentMoudle');
    $router->get('/mainadv/contentmoudle/create/{sid}/{id}', 'MainAdvController@createcontentMoudle');
    $router->post('/mainadv/contentMoudleSave/save/{sid}', 'MainAdvController@contentMoudleSave');

    $router->post('/mainadv/delmoudle/{id}', 'MainAdvController@delContentGroup');





    $router->put('/mainadv/subjectlist/{sid}/{id}', 'MainAdvController@saveLink');
    $router->get('/mainadv/content/create/{sid}', 'MainAdvController@createContent');
    $router->get('/mainadv/content/create/{sid}/{id}', 'MainAdvController@createContent');
    $router->post('mainadv/subjectlist/contentEditTime', 'MainAdvController@contentEditTime');
    //$router->get('/mainadv/content/create/{sid}/{id}', 'MainAdvController@createContent');

    $router->post('/mainadv/content/save/{sid}', 'MainAdvController@contentSave');
    //编辑
    // $router->post('/mainadv/contentdel/{sid}/{id}', 'MainAdvController@conentdel');

    //取消关联
    $router->post('/mainadv/subjectdel/{rela_id}/{id}','MainAdvController@subjectdel');


});
